package com.zb.Service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.zb.Service.NoticeService;
import com.zb.entity.Notice;
import com.zb.mapper.NoticeMapper;


@Component("NoticeService")
public class NoticeServiceImpl implements NoticeService{
	@Autowired
	private NoticeMapper nm;

	public List<Notice> findNoticeAllNoByUserId(int index,int size,int userId) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("index", (index-1)*size);
		params.put("size", size);
		params.put("userId",userId);
		return nm.findNoticeAllNoByUserId(params);
	}

	public List<Notice> findNoticeAllOk(int index,int size) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("index", (index-1)*size);
		params.put("size", size);
		return nm.findNoticeAllOk(params);
	}

	public Notice getNoticeById(int id) {
		Map<String, Object> params = new HashMap<String, Object>();
		params.put("id", id);
		return nm.getNoticeById(params);
	}

	public void saveNotice(Notice n) {
		nm.saveNotice(n);
		
	}

	public int findNoticeAllOkcount() {
		return nm.findNoticeAllOkcount();
	}

	public int findNoticeAllNoByUserIdcount(int id) {
		
		return nm.findNoticeAllNoByUserIdcount(id);
	}

	public void updateNotice(Notice n) {
		nm.updateNotice(n);
		
	}

	

}